home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 June: Reference Library / Dev.CD Jun 96 RL / Dev.CD Jun 96 RL.toast / Technical Documentation / develop / develop Issue 24 / develop Issue 24 code / Scriptable Database 1.0a15 / Application / HFSBackingStore.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-19  |  1.5 KB  |  64 lines  |  [TEXT/CWIE]

  1.  
  2. #ifndef __HFSBACKINGSTORE__
  3. #define __HFSBACKINGSTORE__
  4.  
  5. //
  6. // For class definition of TAbstractBackingStore,
  7. // base class of THFSBackingStore
  8. //
  9. #include "DatabaseDocument.h"
  10.  
  11. //
  12. // For class definition of TFSSpecification,
  13. // a field of THFSBackingStore
  14. //
  15. #include "FSSpecification.h"
  16.  
  17. //
  18. // What is a good cookie to indicate 'file closed'?
  19. //
  20. enum
  21. {
  22.     kFileNotOpen = -1
  23. };
  24.  
  25. #define kDBCreator 'db++'
  26. #define kDBType 'db  '
  27. #define kHFSBackingStore 'hfs '
  28.  
  29. //================================================================================
  30. // Class THFSBackingStore
  31. //================================================================================
  32. class THFSBackingStore : public TAbstractBackingStore
  33. {
  34. private:
  35.     TFSSpecification                    fFileSpec;
  36.     TOpenFileRefNum                        fRefNum;
  37.     Int64                                fFileEOF;
  38.     OSType                                fFileCreator;
  39.     OSType                                fFileType;
  40.     
  41. public:
  42.     THFSBackingStore();
  43.     THFSBackingStore(TFSSpecification& fileSpec);
  44.     THFSBackingStore(TFSSpecification& fileSpec, OSType fileCreator, OSType fileType);
  45.     virtual ~THFSBackingStore();
  46.  
  47.     virtual long                        BackingStoreType() const;
  48.     
  49.     virtual Boolean                        CanSaveDocument();
  50.     
  51.     virtual void                        Read(void* bufferStart, Int64 startByteInFile, long numberOfBytes);
  52.     virtual void                        Write(void* bufferStart, Int64 startByteInFile, long numberOfBytes);
  53.  
  54.     virtual void                        DocumentName(TUpdataDataReference& name);
  55.  
  56.     TFSSpecification                    FileSpec() { return fFileSpec; }
  57.  
  58. protected:
  59.     void                                OpenFile();
  60.     void                                CloseFile();
  61. };
  62.  
  63. #endif
  64.